package com.shop.shopmall.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.shopmall.pojo.GoodsRule;
import com.shop.shopmall.service.GoodsRuleService;
import com.shop.shopmall.mapper.GoodsRuleMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
* @author jamie
* @description 针对表【goods_rule】的数据库操作Service实现
* @createDate 2025-03-20 11:53:30
*/
@Service
public class GoodsRuleServiceImpl extends ServiceImpl<GoodsRuleMapper, GoodsRule>
    implements GoodsRuleService{


    @Override
    public IPage<GoodsRule> getGoodsRuleList(GoodsRule goodsRule) {
        // 设置分页内容
        IPage<GoodsRule> page = new Page<>(goodsRule.getPageNum(), goodsRule.getPageSize());
        LambdaQueryWrapper<GoodsRule> wrapper = new LambdaQueryWrapper<>();
        // 设置查询条件
        if(!StringUtils.isEmpty(goodsRule.getRuleName())){
            wrapper.eq(GoodsRule::getRuleName,goodsRule.getRuleName());
        }
        return this.baseMapper.selectPage(page, wrapper);
    }

}




